<template>
  <div>
    <div>
      <van-nav-bar
        fixed
        placeholder
        safe-area-inset-top
        title="直联直买订单详情"
        left-arrow
        @click-left="back"
      />
    </div>
    <div class="topimg">
      <img src="../../assets/orderbanner02.png" alt="" />
    </div>
    <div class="information">
      <div>
        <div>订单编号</div>
        <div>
          {{ orderData.trust_sn }}
        </div>
      </div>
      <div>
        <div>房源编号</div>
        <div>{{ orderData.house_sn }}</div>
      </div>
      <div class="ding">
        <div>订单名称</div>
        <div>直连直买订单</div>
      </div>
      <div class="xia">
        <div>下单时间</div>
        <div>{{ orderData.create_time }}</div>
      </div>
    </div>
    <div class="card">
      <div>
        <div>
          <span>{{ orderData.contact_name }}</span
          ><span>业主</span>
        </div>
        <div><van-icon size="20px" name="phone-o" @click="call" /></div>
      </div>
      <div @click="goDetail">
        <div class="img">
          <van-image
            width="95px"
            height="80px"
            lazy-load
            :src="orderData.house_image"
            fit="cover"
            radius="5px"
            style="margin-right: 10px"
          />
          <div :class="orderData.putaway == 1 ? 'statusxia' : 'status'">
            {{ orderData.putaway == 1 ? "下架" : "上架" }}
          </div>
        </div>
        <div>
          <div>{{ orderData.subdistrict }}</div>
          <div>地址:{{ orderData.address }}</div>
          <div>{{ orderData.house_type }}|{{ orderData.floor }}</div>
          <div style="color: #d43b33; font-size: 18px">
            {{ orderData.listed_price }}万
          </div>
        </div>
      </div>
    </div>
    <div class="cut" />
    <div class="bottom">
      <div>
        <div>服务费用</div>
        <div>199元</div>
      </div>
      <!-- <div>
        <div style="margin-bottom: 5px">
          *如房东无法联系，可通过投诉申请退还积分
        </div>
        <div>*如在联系时房源已租，可通过投诉申请退还积分</div>
      </div> -->
    </div>
    <div class="btn" @click="back">
      <button>朕知道啦</button>
    </div>
    <van-overlay :show="show" class="zhe">
      <img src="@/assets/loudou.gif" alt="" width="50px" />
    </van-overlay>
  </div>
</template>

<script>
import { integralOrderDetail } from "@/apis/integral";
import { virtualNum, contactOwnerTrust } from "@/apis/user.js";

export default {
  data() {
    return {
      // id: "",
      orderData: "",
      show: true,
      // user_id: "",
    };
  },
  created() {
    this.getOrderDetail();
  },
  methods: {
    call() {
      window.location.href = `tel:${this.orderData.contact_mobile}`;
    },
    getOrderDetail() {
      contactOwnerTrust({ trust_id: this.$route.query.trustId }).then((res) => {
        console.log(res);
        if (res.code == 200 || res.code == 201) {
          this.show = false;
          this.orderData = res.result;
        }
      });
    },
    goDetail() {
      this.$router.push({
        path: "/buyhousedetail",
        query: { houseId: this.orderData.house_id },
      });
    },
    back() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="less" scoped>
.zhe {
  background-color: #fff;
  width: 100vw;
  height: 100vh;
  z-index: 100000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.img {
  position: relative;
  .status {
    position: absolute;
    top: 0;
    left: 0;
    color: #fff;
    background-color: #45b7cb;
  }
  .statusxia {
    position: absolute;
    top: 0;
    left: 0;
    color: #fff;
    background-color: #ccc;
  }
}
.btn {
  button {
    width: 92vw;
    height: 45px;
    margin: 0 15px;
    margin-bottom: 20px;
    border-radius: 22.5px;
    border: 0;
    color: #fff;
    background-image: linear-gradient(90deg, #93d7e6, #45b7cb);
  }
}
.bottom {
  margin: 20px;
  & > div:nth-child(1) {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
    margin-bottom: 15px;
    div:nth-child(1) {
      font-weight: bold;
    }
  }
  & > div:nth-child(2) {
    color: #999999;
    font-size: 12px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 30px;
  }
}
.cut {
  width: 100vw;
  height: 10px;
  background-color: #f1f1f17a;
}
.topimg {
  img {
    width: 100vw;
    height: 37.3vw;
  }
}
.information {
  margin: 0 20px;
  box-sizing: border-box;
  .ding {
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
  }
  & > div {
    display: flex;
    justify-content: space-between;
    div:nth-child(1) {
      font-weight: bold;
    }
  }
  & > div:nth-child(1) {
    margin: 20px 0;
  }
  & > div:nth-child(2) {
    margin: 40px 0;
  }
  & > div:nth-child(4) {
    padding-top: 20px;
    margin-bottom: 40px;
  }
}
.card {
  margin: 0 20px;
  margin-bottom: 20px;
  & > div:nth-child(1) {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
  }
  & > div:nth-child(2) {
    display: flex;
    align-items: center;
    div {
      margin: 5px 0;
    }
  }
  .van-icon {
    color: #45b7cb;
  }
  & > div:nth-child(1) {
    & > div:nth-child(1) {
      & > span:nth-child(2) {
        width: 30px;
        height: 13px;
        font-size: 12px;
        background-color: #45b7cb;
        color: #fff;
        border-radius: 6px;
        box-sizing: border-box;
        padding: 0 5px;
        margin-left: 3px;
      }
    }
  }
  & > div:nth-child(2) {
    div:nth-child(2) {
      font-size: 14px;
      div:nth-child(1) {
        font-weight: bold;
        font-size: 16px;
      }
    }
  }
}
</style>